<template>
    <el-row class="menu_page">
         <el-col>
             <el-menu
                mode="vertical"
                background-color="#324057"
                text-color="#fff"
                active-text-color="#409eff" 
                class="el-menu-vertical-demo">
                <router-link to="/home">
                    <el-menu-item index="0">
                        <i class="fa fa-margin fa-server"></i>
                        <span slot="title">首页</span>
                    </el-menu-item>
                </router-link>

         

                <template  v-for="item in items" >
                    <el-submenu v-if="item.children" :index="item.path" :key="item.path">
                        <template slot="title">
                            <i :class="'fa fa-margin '+item.icon"></i>
                            <span slot="title">{{item.name}}</span>
                        </template>
                        <router-link v-for="(citem,cindex) in item.children" 
                            :to="citem.path" :key="cindex">
                            <el-menu-item 
                                :index='citem.path'>
                                <span slot="title">{{citem.name}}</span>
                            </el-menu-item> 
                        </router-link>
                    </el-submenu>
                    
                </template>

                <router-link to="/chart">
                    <el-menu-item index="1" class="chart">
                    <i class="el-icon-menu"></i>
                        <span slot="title">资金图表</span>
                    </el-menu-item>
                </router-link>

                 <router-link to="/message">
                    <el-menu-item index="2" class="message">
                        <i class="el-icon-document"></i>
                        <span slot="title">员工留言</span>
                    </el-menu-item>
                </router-link>

                  <router-link to="/purchase">
                    <el-menu-item index="3" class="purchase">
                        <i class="el-icon-edit"></i>
                        <span slot="title">采购申请</span>
                    </el-menu-item>
                </router-link>
             </el-menu>
         </el-col>
    </el-row>
</template>
<script>
export default {
  name: 'leftmenu',
  data() {
    return {
      items: [
        {
          icon: 'fa-money',
          name: '资金管理',
          path: 'fund',
          children: [{ path: 'foundlist', name: '资金流水' }],
        },
        {
          icon: 'fa-asterisk',
          name: '信息管理',
          path: 'info',
          children: [
            { path: 'infoshow', name: '个人信息' },
            { path: 'staff', name: '员工信息' },
            { path: 'supplier', name: '供应商信息' },
          ],
        },
      ],
    }
  },
}
</script>
<style scoped>
.chart .message {
  padding-left: 12px !important;
}
.menu_page {
  position: fixed;
  top: 71px;
  left: 0;
  min-height: 100%;
  background-color: #324057;
  z-index: 99;
}
.el-menu {
  border: none;
}
.fa-margin {
  margin-right: 5px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 180px;
  min-height: 400px;
}
.el-menu-vertical-demo {
  width: 35px;
}
.el-submenu .el-menu-item {
  min-width: 180px;
}

.hiddenDropdown,
.hiddenDropname {
  display: none;
}
a {
  text-decoration: none;
}
</style>
